package com.manor.paradise.adapter

/*
 *  viewpager普通公用adapter.Yz
 */


import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.PagerAdapter
import java.util.*

/**
 * 已拥有
 */
class CommonPagerAdapter : FragmentPagerAdapter {

    private var fragments: List<Fragment>? = null

    constructor(fm: FragmentManager, fragments: List<Fragment>) : super(fm) {
        this.fragments = fragments
    }

    constructor(fm: FragmentManager, vararg fragments: Fragment) : super(fm) {
        this.fragments = Arrays.asList(*fragments)
    }

    override fun getItem(position: Int): Fragment {
        return fragments!![position]
    }

    override fun getCount(): Int {
        return fragments?.size ?: 0
    }

    override fun getItemPosition(`object`: Any): Int {
        return PagerAdapter.POSITION_NONE
    }
}
